package com.snack.shop.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 商家统计数据DTO
 */
@Schema(description = "商家统计数据")
@Data
public class MerchantStatsDTO {
    
    // ========== 零食订单统计 ==========
    @Schema(description = "零食订单总销售额")
    private BigDecimal snackTotalSales;
    
    @Schema(description = "零食订单总数")
    private Integer snackTotalOrders;
    
    @Schema(description = "零食购买用户数")
    private Integer snackTotalUsers;
    
    @Schema(description = "零食客单价")
    private BigDecimal snackAvgPrice;

    // 顶层汇总（用于前端总览卡片）
    @Schema(description = "总购买用户数（零食）")
    private Integer totalUsers;

    @Schema(description = "客单价（零食）")
    private BigDecimal avgPrice;
    
    @Schema(description = "零食待接单数量")
    private Integer snackPendingOrders;
    
    @Schema(description = "零食配送中数量")
    private Integer snackDeliveringOrders;
    
    @Schema(description = "零食已完成数量")
    private Integer snackCompletedOrders;
    
    @Schema(description = "零食已取消数量")
    private Integer snackCancelledOrders;
    
    // ========== 代取订单统计 ==========
    @Schema(description = "代取订单总数")
    private Integer pickupTotalOrders;
    
    @Schema(description = "代取订单总金额")
    private BigDecimal pickupTotalAmount;
    
    @Schema(description = "代取平台服务费收入")
    private BigDecimal pickupPlatformFee;
    
    @Schema(description = "代取待结算金额（商家需支付给接单人）")
    private BigDecimal pickupPendingSettlement;
    
    @Schema(description = "代取已结算金额")
    private BigDecimal pickupSettledAmount;
    
    @Schema(description = "代取待接单数量")
    private Integer pickupPendingOrders;
    
    @Schema(description = "代取进行中数量（待取件+配送中+已送达）")
    private Integer pickupInProgressOrders;
    
    @Schema(description = "代取待结算数量")
    private Integer pickupWaitingSettlement;
    
    @Schema(description = "代取已完成数量")
    private Integer pickupCompletedOrders;

    // ========== 代取退款与补偿统计 ==========
    @Schema(description = "代取已退款订单数")
    private Integer pickupRefundedOrders;

    @Schema(description = "代取退款且有补偿的订单数")
    private Integer pickupRefundCompensationOrders;

    @Schema(description = "代取退款总金额")
    private BigDecimal pickupRefundTotalAmount;

    @Schema(description = "代取补偿总额")
    private BigDecimal pickupCompensationTotal;

    @Schema(description = "代取补偿申请中金额（settlementStatus=1）")
    private BigDecimal pickupCompensationPendingSettlement;

    @Schema(description = "代取补偿已结算金额（settlementStatus=2）")
    private BigDecimal pickupCompensationSettledAmount;
    
    // ========== 总计统计 ==========
    @Schema(description = "总销售额（零食+代取）")
    private BigDecimal totalSales;
    
    @Schema(description = "总订单数（零食+代取）")
    private Integer totalOrders;

    // ========== 订单统计汇总（零食+代取） ==========
    @Schema(description = "待接单（聚合）")
    private Integer pendingOrders;

    @Schema(description = "配送中（聚合）")
    private Integer deliveringOrders;

    @Schema(description = "已完成（聚合）")
    private Integer completedOrders;

    @Schema(description = "已取消（含退款，聚合）")
    private Integer cancelledOrders;
}

